
  {% include "../header.html" %}

  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;">
    <table class="layui-table">
  <colgroup>
    <col width="20">
    <col width="120">
    <col width="100">
    <col>
    <col width="200">
  </colgroup>
  <thead>
    <tr>
      <th>id</th>
      <th>时间</th>
      <th>栏目</th>
      <th>标题</th>
      <th>管理</th>
    </tr> 
  </thead>
  <tbody>
  {% if len(arts) == 0 %}
        什么都没有了
  {% end %}
{% for art in arts %}
    <tr>
      <td>{{art.id}}</td>
      <td>{{art.updateDate.strftime("%Y-%m-%d")}}</td>
      <td>{{ navName(art.tid)}}</td>
      <td> <a href="/art/{{art.id}}">{{art.title}}</a></td>
      <td>
            <a href="/admin/article/update/{{art.id}}"><button class="layui-btn">修改</button></a>

            <a href="javascript:deletes({{art.id}})"><button class="layui-btn">删除</button></a>
      </td>
    </tr>
{% end %}
  </tbody>
</table>
  
      <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1">
      {% if not int(page) == 1 %}
            <a href="/admin/article?p={{int(page) - 1}}" class="layui-laypage-prev  ">上一页</a>
      {% end %}
      {% if len(arts) == 10 %}
        <a href="/admin/article?p={{int(page) + 1}}" class="layui-laypage-next   " >下一页</a>
      {% end %}
      </div>
    </div>
  

  </div>
  <script>
        function deletes(id) {
      let url = "/admin/article/del/";
            layer.confirm('真的要删除?？', {
  btn: ['删除','取消'] //按钮
}, function(){
    getdel(url+id)
}, function(){

});
  }
  function getdel(url) {
      $.get(url,
      function (data,status) {
         data = JSON.parse(data)
       if(data.code === 1){
          document.location.href=""
       }
       if(data.code === 0){
            layer.msg(data.message)
       }
      })
  }
  </script>
 
{% include "../footer.html" %}